package com.digest.conf;

import com.digest.Digest;
import com.digest.impl.Md5Digest;
import com.digest.impl.ShaDigest;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
//@EnableConfigurationProperties(Settings.class)
public class Config {
    @Bean
    @ConditionalOnProperty(prefix = "digest", name = "type", havingValue = "md5")
    public Digest md5Digest() {
        System.out.println("Loading md5Digest object!!!");
        return new Md5Digest();
    }
    @Bean
    @ConditionalOnProperty(prefix = "digest", name = "type", havingValue = "sha")
    public Digest shaDigest(){
        System.out.println("Loading shaDigest object!!!");
        return new ShaDigest();
    }
}
